<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>C++ Hello World 在线演示平台</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/daisyui/4.12.10/full.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        .code-editor {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            background-color: #1e1e1e;
            color: #d4d4d4;
        }
        .output-terminal {
            background-color: #000;
            color: #00ff00;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
        }
    </style>
</head>
<body class="bg-gray-100">
    <div class="container mx-auto px-4 py-8">
        <div class="text-center mb-8">
            <h1 class="text-4xl font-bold text-gray-800 mb-2">
                <i class="fas fa-code text-blue-600"></i>
                C++ Hello World 在线演示平台
            </h1>
            <p class="text-gray-600">无需安装环境，在线编写、编译并运行C++代码</p>
        </div>

        <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
            <!-- 代码编辑器 -->
            <div class="bg-white rounded-lg shadow-lg">
                <div class="bg-gray-800 text-white px-4 py-3 rounded-t-lg flex items-center justify-between">
                    <span class="font-semibold">
                        <i class="fas fa-edit mr-2"></i>
                        代码编辑器
                    </span>
                    <button id="resetBtn" class="btn btn-sm btn-ghost">
                        <i class="fas fa-undo mr-1"></i>
                        重置
                    </button>
                </div>
                <textarea id="codeEditor" class="code-editor w-full h-96 p-4 resize-none border-0 focus:outline-none" 
                          placeholder="在这里输入C++代码..."></textarea>
            </div>

            <!-- 输出终端 -->
            <div class="bg-white rounded-lg shadow-lg">
                <div class="bg-gray-800 text-white px-4 py-3 rounded-t-lg flex items-center justify-between">
                    <span class="font-semibold">
                        <i class="fas fa-terminal mr-2"></i>
                        输出结果
                    </span>
                    <button id="runBtn" class="btn btn-sm btn-primary">
                        <i class="fas fa-play mr-1"></i>
                        运行
                    </button>
                </div>
                <div id="output" class="output-terminal w-full h-96 p-4 overflow-y-auto">
                    <div class="text-gray-400">点击"运行"按钮执行代码</div>
                </div>
            </div>
        </div>

        <!-- 使用说明 -->
        <div class="mt-8 bg-white rounded-lg shadow-lg p-6">
            <h2 class="text-2xl font-bold text-gray-800 mb-4">
                <i class="fas fa-info-circle text-blue-600 mr-2"></i>
                使用说明
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-gray-600">
                <div>
                    <h3 class="font-semibold mb-2">功能特点</h3>
                    <ul class="list-disc list-inside space-y-1">
                        <li>实时在线编译运行C++代码</li>
                        <li>支持标准C++语法</li>
                        <li>自动清理临时文件</li>
                        <li>安全的沙箱环境</li>
                    </ul>
                </div>
                <div>
                    <h3 class="font-semibold mb-2">注意事项</h3>
                    <ul class="list-disc list-inside space-y-1">
                        <li>代码运行时间限制为5秒</li>
                        <li>禁止使用系统调用和文件操作</li>
                        <li>仅支持标准输入输出</li>
                        <li>适合学习和测试用途</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <script src="script.js"></script>
</body>
</html>
